package com.sylar.happygps;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import com.sylar.happygps.adapter.SearchNavAdapter;

public class SearchResultActivity extends Activity implements OnClickListener,OnItemClickListener {
	private SearchNavAdapter searchNavAdapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.searchlist);

		Button btn_title_left = (Button) findViewById(R.id.btn_title_left);
		btn_title_left.setText(R.string.app_name);
		btn_title_left.setVisibility(View.VISIBLE);
		btn_title_left.setOnClickListener(this);

		TextView tv_title_name = (TextView) findViewById(R.id.tv_title_name);
		tv_title_name.setText("网上搜索导航数据");

		
		ListView list_search = (ListView) findViewById(R.id.list_search);
		list_search.setOnItemClickListener(this);
		searchNavAdapter = new SearchNavAdapter(this);
		list_search.setAdapter(searchNavAdapter);
		
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_title_left:
			finish();
			break;
		default:
			break;
		}
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		toMap();
	}
	
	//地图
	private void toMap(){
		Intent intent = new Intent(this,MapActivity.class);
		startActivity(intent);
	}
}
